#include <stdio.h>
#include "LineList.c"
//#include "test.c"

void merger(SqList* A,SqList* B);

int main(){
	SqList a,b;
	InitList(&a);
	InitList(&b);

	unsigned int a1[]={1,2,4,61,2,5,5,6,8};
	unsigned int b1[]={1,2,5,9,7};

	FillList(&a,a1,6);
	FillList(&b,b1,5);

	merger(&a,&b);

	DestoryList(&a);
	DestoryList(&b);
    getch();
}

void merger(SqList* A,SqList* B){
	int la,lb,i,index;
	ElemSet e;
	la=ListLength(A);
	lb=ListLength(B);

for(i=0;i<la;i++){
	printf("%d\n",A->elem[i] );
}

	for(i=0;i<lb;i++){
		e=B->elem[i];
		index=LocLteElem(A,e,equal);
		if(index==0) ListInsert(A,la,e);
	}

}

void ListUnion(SqList* L,SqList* B){
	if(L->elem==NULL || B->elem==NULL) return FAILURE;
	int len=ListLength(L);
	int lb=ListLength(B);
	int i,j,index;
	for(i=0;i<len;i++){
		for(j=0;j<lb;j++){
			if(index=(LocLteElem(L,B->elem[j],equal))==0) return FAILURE;
			ListInsert(L,index,B->elem[j]);
		}
	}
}
